﻿using System.Collections.Generic;
using System.Data;
using ClientSite2nd.CurrenciesService;
using ClientSite2nd.Logic;

namespace ClientSite2nd.Models
{
    public class Currencies
    {
        public IList<Currency> All
        {
            get
            {
                CurrencyWCFServiceClient proxy = new CurrencyWCFServiceClient();
                List<Currency> currencies = new List<Currency>();
                foreach (DataRow row in proxy.GetCurrencyForCompany(SessionWrapper.CurrentClient.Company).Rows)
                {
                    Currency currency = new Currency();
                    currency.CurrencyName = (string)row["CurrencyName"];
                    currency.Buy = (decimal)row["BankBuy"];
                    currency.Sell = (decimal)row["BankSell"];
                    currencies.Add(currency);
                }
                return currencies;
            }
        }

    }
}